Ex001, First application
If you are new in Delphi this will be your first small application, if you have
used Delphi before you can just skim this exercise to be familiar with other exercises
method of this book.
Exercise 001: First application
To build your first Delphi application do the following steps:
1. Run Delphi.
2. At file menu click New Application.
3. From standard page at component palette drop a Button.
4. Click dropped Button then goto Object inspector. If object inspector does not
appear press F11.
5. Object inspector have two pages: properties and events. Click properties tab.
6. At caption property and type '&Hello' instead of 'Button1'.
7. Click events tab.
8. Double click on OnClick white combo box.
9. Write this code at OnClick event procedure:
ShowMessage('Welcome in Delphi');
10. The entire event procedure should be:
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Welcome in Delphi');
end;
11. Press F9 to run you application.
12. When your application run click on Hello button to display Welcome message.
13. Now you have a complete windows-based application; you can maximize, minimize,
resize and move your application form as any normal windows application.
14. Click at close button ( at the upper right corner of form )
15. After closing your application you will be returned back to designer.
to save your project follow this steps:
1. On File menu click Save Project As.
2. Select directory or create new one for this project or for your all projects.
3. Write First.pas in save as dialog box to save your form.
4. Write FirstP.dpr for project name.
5. Compile the program again ( press Ctrl + F9 )
6. After compilation you will find FirstP.exe in directory you have saved your project
in.
7. You can run FirstP.exe in any computer without need for Delphi.
8. Now you have build stand-alone windows exceutable file.